# Restoring (or migration) a virtual maschine
VMWare/MS Virtual Server

more tips

## The conventional method

Just boot the virtual machine, using a DOS or BartPE Bootdisk.
Restore the machine like a 'normal' one, probably using the network.

## A better way to do it

Create a new (virtual) disk, using the supplied virtual machine tools.
There's no need to partition it (yet).

Next, you mount the virtual disk into your host system as a virtual disk.

Microsoft Virtual Server 2005 R2 Service Pack 1 has a command line tool VHDMount, which allows to mount a .VHD as virtual drive.

Mounting a .vhd: vhdmount.exe /p VirtualDISK.VHD
Unmounting a .vhd: vhdmount.exe /u VirtualDISK.VHD

unfortunately, VMWare Server just provides a tool DISKMOUNT that mounts single partitions into the host, not the entire disk; so partitioning of the disk isn't possible.

Luckily, Ken Kato has created an Open Source Driver VDK, that allows to mount entire VMWare disks.
The original at http://chitchat.at.infoseek.co.jp/vmware/vdk.html is no longer availkable.
Unfortunately, neither Windows Disk Manager nor Drive Snapshot detect this disk.
Luckily, VDK is open source (thanks, Ken), and we could modify VDK (slightly), so that at least Drive Snapshot recognizes the virtual drive.

Just download VDK.EXE (no warranties of any kind).
Sourcecode is available here.

Mounting a .VMDK: vdk open 0 VirtualDISK.VMDK /RW
Unmounting a VMDK: vdk close 0 /F /Q

## Restoring the virtual Machine

Use the Snapshot GUI to restore; otherwise you might end up restoring to the wrong physical disk.
Start Snapshot , [Restore], select the Image, [next].
Right click in the Graphic bottom, left onto [HD2 VDK VMWARE 200 GB].
Choose Restore Partition structure.
After that, the original partitioning has been restored.
After that, restore all partitions.

Done.
Unmount the disk, and boot it with Virtual Server/VMWare.

## Done ? Trap 1

When booting, you get a "Inaccessible Boot Device" or "Stop 0x0000007b".
The operating system doesn't recognize the (emulated) disk controller.
Easiest solution: tell VMWare to make the disk an IDE disk, each operating system in universe will recognize IDE disks.
If that's not an option (because VMWare ESX server doesn't emulate IDE disks), you have to install a driver for the (virtual) disk.
This is easiest done from the command line by

C:>Snapshot --AddDriver (requires a current Snapshot.exe)

this will ask for the driver (DiskDriver.SYS), and the location of the restored Windows, where the driver shall be installed (NewDrive:\Windows).
It's your responsibility to select the proper driver for the restored operating system (XP/2003/Vista, X86/X64).
This driver is forced to start the next time Windows is started.
It's recommended to install this driver again in the booted windows, as some (optional) control elements might be missing.

This approach also works for 'real' hardware, but requires restore from BartPE (or any other WinPE variant), to teach Windows a new RAID controller etc.

Done.
unmount disk, and boot Virtual Server/VMWare.

## Done ? Trap 2

A messagebox pops up, notifying you that the hardware was changed, and Windows wants to be reactivated.
Unfortunately your network card doesn't work (yet), as this is new hardware, so activation over internet doesn't work.

Solution 1: use Snapshot --AddDriver to teach the system the new network card.
Solution 2: call Microsoft - they wanted to be called for activation ;)

## Done ? Trap 3

everything is fine, the machine boots, but when you login, you are immediately logged of.
Funny, isn't it....

Background and solution: probably you restored the current host into the VM.
Windows gives each disk a unique ID, so called 'disk signature' (32-bit number in the MBR).
Some resources do NOT acess 'first partition on first disk', but 'first partition on disk with ID 1234'.

Windows takes also care, that there are no 2 disks with the same disk signature, it will actively change the signature on a second disk if a duplicate ID is found.

When you restored the partition structure, Windows modified the disk signature to 'something different'.

Solution: after partitioning, and restore, go again to

[Restore], select Image , [next].
right click on [HD2 VDK VMWARE 200 GB].
select Restore DiskSignature.

After that, unmount (and never mount again) the virtual disk.

## Comments

are welcome

## Good luck

more Tipps

Copyright © 2001-2016 Tom Ehlert Software